import { nextTick } from "vue";
import { useFormItem } from "element-plus";

//  触发el-form-item的校验事件 trigger
export function useTrigger() {
  const { formItem } = useFormItem();
  const emitTrigger = () => {
    if (formItem) {
      nextTick(() => {
        formItem.validate("blur");
        formItem.validate("change");
      });
    }
  };
  return { emitTrigger };
}
